import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] nums = new int[n];
        int max = -1;
        for(int i = 0;i < n;i++)
        {
            nums[i] = in.nextInt();
            max = Math.max(max,nums[i]);
        }


        boolean f = false;//表示是可以转化的
        for(int i = 0;i < n;i++)
        {
            //1.判断是否有余数
            if(max % nums[i] != 0)
            {
                f = true;
                break;
            }
            //判断是2倍关系
            int x = max / nums[i];
            if((x & (x -1)) != 0)
            {
                f = true;
                break;
            }
        }

        if(f) System.out.println("NO");
        else System.out.println("YES");

    }
}